package com.esd.db.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.esd.db.dao.InspectorMarkTimeRecordMapper;
import com.esd.db.model.InspectorMarkTimeRecord;
import com.esd.db.service.InspectorMarkTimeRecordService;

@Service("InspectorMarkTimeRecordService")
public class InspectorMarkTimeRecordServiceImpl implements InspectorMarkTimeRecordService {
	@Autowired
	InspectorMarkTimeRecordMapper imtrMapper;

	@Override
	public int saveOne(InspectorMarkTimeRecord imtr) {
		return imtrMapper.saveOne(imtr);
	}

	@Override
	public double queryFirstInspectorMarkTime(int workerId, String uploadUUID, int sendBackType,
			int[] unqualifiedTaskIds, int taskEffective) {
		Map<String, Object> map = new HashMap<>();
		map.put("workerId", workerId);
		map.put("uploadUUID", uploadUUID);
		if(taskEffective!=3){
			map.put("sendBackType", sendBackType);
			map.put("unqualifiedTaskIds", unqualifiedTaskIds);
		}else{
			map.put("sendBackType", 0);
		}
		return imtrMapper.queryFirstInspectorMarkTime(map);
	}

	@Override
	public double querySecondInspectorMarkTime(List<Integer> recordIds) {
		Map<String, Object> map = new HashMap<>();
		map.put("recordIds", recordIds);
		return imtrMapper.querySecondInspectorMarkTime(map);
	}

	@Override
	public double queryQuickInspectorMarkTime(int packId, int[] workerIds, int taskEffective) {
		Map<String, Object> map = new HashMap<>();
		map.put("packId", packId);
		if(taskEffective==0){
			map.put("workerIds", workerIds);
		}else{
			map.put("workerIds", null);
		}
		return imtrMapper.queryQuickInspectorMarkTime(map);
	}

	@Override
	public List<Map<String, Object>> queryInspectionMarkTimeRecordListByConditions(
			Map<String, Object> conditions) {
		return imtrMapper.queryInspectionMarkTimeRecordListByConditions(conditions);
	}


}
